package cn.yc.reader;

import java.io.BufferedReader;
import java.io.FileReader;

public class BufferedReader_ {
    public static void main(String[] args) throws Exception {
        String filePath = "e:\\io\\story.txt";
        BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
        //读取
        String line;
        // 按行读取
        /*
        注意这里的readline是按行读取
         */
        while ((line = bufferedReader.readLine()) != null) {
            System.out.println(line);
        }

        /* 关闭流
         注意： 这里只需要关闭 BufferedReader，因为底层的会自动去关闭节点流
         */
        bufferedReader.close();
    }
}
